#include <iostream>
using namespace std;
#include <queue>
int main(){
    queue<int> ji;
    queue<int> o;
    int n;
    cin>>n;
    int b=n;
    while(n--){
        int a;
        cin>>a;
        if(a%2==0){
            o.push(a);
        }else{
            ji.push(a);
        }
    }
    while(!ji.empty()){
        int cnt = 2,i = 0;
        while(cnt--&&!ji.empty()){
            if(i++)cout<<" ";
            cout<<ji.front();
            ji.pop();
        }
        if(!o.empty()){
            cout<<" "<<o.front()<<" ";
            o.pop();
        }
    }
    int i=0;
    while(!o.empty()){
        if(i++)cout<<" ";
        cout<<o.front();
        o.pop();
    }
    return 0;

}